"""This module provides access to FT model"""

import pellet

def ftreactormodel(bedProp, feedProp, ratelaw, material, solverOpt):
    """Main entry for the model
    bed: bed parameters
    feed: feed parameters
    ratelaw: rate law's parameters
    material: material properties
    solveropt: solver's option
    """
    Bed(bedProp)
    Feed(feedProp)
    pass

class Bed():
    """FT bed class"""
    def __init__(self, bedProp):
        if not bedProp:
            raise ValueError('The bed prop array is empty')
        self.stages = [Stage(stageprop) for stageprop in bedProp]
        
class Stage():
    """Stage in the bed"""
    def __init__(self, stageProp):
        if not stageProp:
            raise ValueError('The stage prop array is empty')
        self.parse_prop(stageProp)
        
    def parse_prop(self, stageProp):
        if 1 == stageProp[0]:
            self.hasBoundary = True
        else:
            self.hasBoundary = False
        [self.diameter, self.length, self.pressure,
         self.wallTemp, self.heatCoeff] = stageProp[1:6]
        self.pressure *= 1.013e5
        self.wallTemp += 273.15
  
        [self.catWeight, self.catActivity, 
          self.catDensity, self.catShape] = stageProp[6:10]
          
        [self.pelletOutDiameter, self.pelletInDiameter,
         self.pelletHeight, self.porosity, self.tortuosity] = stageProp[10:15]
        self.pelletOutDiameter /= 10 # mm->cm
        self.pelletInDiameter /= 10 # mm->cm
        self.pelletHeight /= 10 # mm->cm
         
        [self.bulkVoidage, self.gasViscosity, 
          self.gasThermConductivity, self.gasHeatCpG] = stageProp[15:19]
          
        [self.diffusivityN2, self.diffusivityCO, self.diffusivityH2,
          self.diffusivityCH4, self.diffusivityH2O, 
          self.diffusivityCO2] = stageProp[19:25]

         
class Feed():
    """Feed condition class"""
    def __init__(self, feedProp):
        if not feedProp:
            raise ValueError('The feed prop array is empty')
        [self.conN2, self.conCO, self.conH2, self.conCH4, self.conH2O] = feedProp[0:5]
        self.flowRate = feedProp[5]
        self.temperature = feedProp[6] + 273.15
         
        
        
        
        
            